/* =====================================================================================
/   TABLE: [ItemList]
/  ===================================================================================== */

if exists (select * from [dbo].sysobjects where id = object_id(N'[dbo].[ItemList]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ItemList]
GO

CREATE TABLE [dbo].[ItemList](
	[Id] [uniqueidentifier] NOT NULL,
	[PageId] [uniqueidentifier] NOT NULL,
	[Title] [nvarchar](250) NOT NULL,
	[Description] [nvarchar](max) NULL,
	[ShortContent] [nvarchar](max) NULL,
	[Content] [nvarchar](max) NULL,
	[CreatedBy] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ModifiedBy] [int] NOT NULL,
	[ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_ItemList] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
USE [MvcEngine]
GO
ALTER TABLE [dbo].[ItemList]  WITH CHECK ADD  CONSTRAINT [FK_ItemList_Pages] FOREIGN KEY([PageId])
REFERENCES [dbo].[Pages] ([PageId])
GO
ALTER TABLE [dbo].[ItemList]  WITH CHECK ADD  CONSTRAINT [FK_ItemList_Users] FOREIGN KEY([CreatedBy])
REFERENCES [dbo].[Users] ([Id])
GO
ALTER TABLE [dbo].[ItemList]  WITH CHECK ADD  CONSTRAINT [FK_ItemList_Users1] FOREIGN KEY([ModifiedBy])
REFERENCES [dbo].[Users] ([Id])
GO


/* =====================================================================================
/   Permissions
/  ===================================================================================== */

INSERT INTO [dbo].[PermissionGroups]
VALUES ('{C21985A5-1996-4e25-860E-B51477D6DFB0}', 'ListItem', 'ListItem group', '09.09.2009 0:00:00', 16, '09.09.2009 0:00:00', 16)

INSERT INTO [dbo].[PermissionKeys]
VALUES ('{50745491-AE3D-465e-88BF-9A48E1C15B84}', 'ItemList_NewItemList', 'Create new ItemList', '{C21985A5-1996-4e25-860E-B51477D6DFB0}', '09.09.2009 0:00:00', 16, '09.09.2009 0:00:00', 16)

INSERT INTO [dbo].[PermissionKeys]
VALUES ('{F127AE4B-E94A-4463-A07D-434D66E038D6}', 'ItemList_EditItemList', 'Edit ItemList', '{C21985A5-1996-4e25-860E-B51477D6DFB0}', '09.09.2009 0:00:00', 16, '09.09.2009 0:00:00', 16)

INSERT INTO [dbo].[PermissionKeys]
VALUES ('{671DB6AD-92F2-4596-87A6-AE8DC0F9F7F8}', 'ItemList_DeleteItemList', 'Delete ItemList', '{C21985A5-1996-4e25-860E-B51477D6DFB0}', '09.09.2009 0:00:00', 16, '09.09.2009 0:00:00', 16)

INSERT INTO [dbo].[Permissions]
VALUES ('{2D66DA70-682F-4f80-8E15-B7678B1B928F}', '{896a8f4d-ca3d-4c87-869d-9dc3cfca6008}', 1 , '{50745491-AE3D-465e-88BF-9A48E1C15B84}', '09.09.2009 0:00:00', 16, '09.09.2009 0:00:00', 16)

INSERT INTO [dbo].[Permissions]
VALUES ('{27755EF1-0ADC-446b-ABE2-8570D6497005}', '{896a8f4d-ca3d-4c87-869d-9dc3cfca6008}', 1 , '{F127AE4B-E94A-4463-A07D-434D66E038D6}', '09.09.2009 0:00:00', 16, '09.09.2009 0:00:00', 16)

INSERT INTO [dbo].[Permissions]
VALUES ('{D6886F50-96C7-402e-827D-7BB5548993D2}', '{896a8f4d-ca3d-4c87-869d-9dc3cfca6008}', 1 , '{671DB6AD-92F2-4596-87A6-AE8DC0F9F7F8}', '09.09.2009 0:00:00', 16, '09.09.2009 0:00:00', 16)
